﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Microsoft.Win32;
using System.Text.RegularExpressions;

namespace FrameworkDetector
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void Form1_Shown(object sender, EventArgs e)
        {
            treeView1.Nodes.Clear();
            treeView1.Nodes.Add("Installed Frameworks");
            RegistryKey objRegistryKey = RegistryKey.OpenRemoteBaseKey(Microsoft.Win32.RegistryHive.LocalMachine, "").OpenSubKey(@"Software\Microsoft\.NetFramework");
            string[] obj = objRegistryKey.GetSubKeyNames();
            foreach (string str in obj)
            {
                if (Regex.IsMatch(str, @"^[v][0-9][.][0-9]"))
                {
                    treeView1.Nodes.Add(str);
                }
            }
        }
    }
}
